package friends;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class SecondReducer extends Reducer<Text,Text,Text,Text> {
    @Override
    protected void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException {
        StringBuilder sb = new StringBuilder();
        //遍历组合字符串拼接
        for (Text friend: values) {
            sb.append(friend).append(",");

        }
        context.write(key,new Text(sb.toString()));
    }

}
